package com.happy.people.control;

import com.happy.people.utils.ResultModel;
import com.happy.people.utils.ResultTools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


@Slf4j
@RestController
@Transactional
@RequestMapping(value = "/wechat")
public class WeChatController {

    @RequestMapping(value = "/pay")
    public ResultModel pay(String payType){
        log.info("支付方式 : " + payType);
        return ResultTools.success();
    }


    /**
     * 异步接收微信支付结果通知的回调地址，通知url必须为外网可访问的url，不能携带参数。
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/WeiXinNotifyUrl")
    public String WeiXin_notify_url(HttpServletRequest request) throws Exception {
        Map<String,String[]> requestParams = request.getParameterMap();
        return "success";
    }
}
